package com.suarte.core;

import com.suarte.utils.Persistent;
import org.appfuse.model.BaseObject;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * @date   Dec 30, 2010
 * @author Ggutierrez
 */

@Entity @Table(name="sa_payment_methods")
public class PaymentMethod extends BaseObject implements Persistent {
    private Long id;
    private String description;

    public PaymentMethod() {
    }

    @Id @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="PAYMENT_METHOD_SEQ")
    @SequenceGenerator(name="PAYMENT_METHOD_SEQ", sequenceName="PAYMENT_METHOD_SEQ",allocationSize=1)
    public Long getId() {
        return id;
    }

    @Column(name="description", length=100)
    public String getDescription() {
        return description;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public String toString() {
        return description;
    }

    @Override
    public boolean equals(Object other) {
        if(other == this){
            return true;
        }
        if(!(other instanceof PaymentMethod)){
            return false;
        }
        PaymentMethod _i = (PaymentMethod)other;
        return id.equals(_i.id);
    }

    @Override
    public int hashCode() {
        return id.hashCode();
    }
}
